package www.dashu.com.domain;

import www.dashu.com.domain.base.BaseVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.Formula;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;

@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name="b_ads_swiper")
public class BAdsSwiper extends BaseVo implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("服务单号")
    @Id
    private Long id;

    @Column(name = "name")
    private String name;

    @Column(name = "img")
    private String img;

    @Column(name = "background_img")
    private String backgroundImg;

    @Column(name = "url")
    private String url;

    @Column(name = "order_num")
    private Long orderNum;

    @Column(name = "flag")
    private String flag;

    @Column(name = "app_id")
    private Long appId;

    @Formula("(select s.name from sys_app s where s.id = app_id )")
    private String appName;

    @Column(name = "create_time")
    private Date createTime;

    @Column(name = "update_time")
    private Date updateTime;


    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", name=").append(name);
        sb.append(", img=").append(img);
        sb.append(", backgroundImg=").append(backgroundImg);
        sb.append(", url=").append(url);
        sb.append(", flag=").append(flag);
        sb.append(", appId=").append(appId);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append("]");
        return sb.toString();
    }

}